package com.zjz.common.demo.oom.inheritance;

import lombok.Getter;
import lombok.Setter;

/**
 * @author Zhang Jinzhong
 * @version V1.0
 * @since 2018-09-29 10:18
 */
public class MountainBike extends Bicycle {

    /**
     * 座位高度
     */
    public int seatHeight;

    // the MountainBike subclass adds a field
    /**
     * 缓冲架
     */
    @Getter
    @Setter
    private String suspension;

    // the MountainBike subclass has one constructor
    public MountainBike(int startHeight, int startCadence, int startSpeed, int startGear) {
        super(startCadence, startSpeed, startGear);
        seatHeight = startHeight;
    }

    public MountainBike(int startCadence, int startSpeed, int startGear, String suspensionType) {
        super(startCadence, startSpeed, startGear);
        this.setSuspension(suspensionType);
    }

    // the MountainBike subclass adds one method
    public void setHeight(int newValue) {
        seatHeight = newValue;
    }

    @Override
    public void printDescription() {
        super.printDescription();
        System.out.println("The " + "MountainBike has a" + getSuspension() + " suspension.");
    }
}
